package com.wyc.service.impl;

import com.wyc.dao.AllAnnMgMapper;
import com.wyc.pojo.AllAnnMg;
import com.wyc.pojo.SuperAdminAnnMg;
import com.wyc.service.AllAnnMgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName AllAnnMgServiceImp
 * @Author 王韫琛
 * @Date 2021/1/28 3:13
 * @Version 1.0
 */
@Service
public class AllAnnMgServiceImp implements AllAnnMgService {
    @Autowired
    private AllAnnMgMapper allAnnMgMapper;
    //获取所有公告总和
    @Override
    public int getTotal() {
        return allAnnMgMapper.getTotal();
    }
    //查询所有公告分页显示
    @Override
    public List<AllAnnMg> findPage(Integer pageNum, Integer pageSize) {
        pageNum = (pageNum-1)*pageSize;
        List<AllAnnMg> list = allAnnMgMapper.findPage(pageNum,pageSize);
        return  list;
    }
    //普通用户按身份搜索公告信息
    @Override
    public List<AllAnnMg> findAllAnnMgByType(String permission,Integer pageNum, Integer pageSize) {
        pageNum = (pageNum-1)*pageSize;
        List<AllAnnMg> list = allAnnMgMapper.findAllAnnMgByType(permission, pageNum, pageSize);
        return list;
    }
    //按照身份获取数据库中得数据总条数
    @Override
    public int getTypeTotal(String permission) {
        return allAnnMgMapper.getTypeTotal(permission);
    }
}
